package org.wlgzs.shop.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.wlgzs.shop.bean.Msg;
import org.wlgzs.shop.bean.OrderTransportData;
import org.wlgzs.shop.service.IOrderTransportDateService;
import org.wlgzs.shop.service.IUserDateService;

import javax.validation.Valid;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * @Author: wangyan
 */

@Api(tags = "这是订单的接口", value = "OrderTransportDateController")
@Controller
@RequestMapping("/order")
public class OrderTransportDateController {

    @Autowired
    IOrderTransportDateService orderTransportDateService;

    @Autowired
    IUserDateService userDateService;
    private static final Logger logger = LoggerFactory.getLogger(OrderTransportDateController.class);

    /**
     * 增加订单信息
     *
     * @param orderTransportData
     * @param result
     * @return Msg
     */
    @ResponseBody
    @RequestMapping("/insertOrderTransportDate")
    @ApiOperation(value = "增加订单信息", httpMethod = "POST", response = Msg.class)
    @ApiImplicitParam(paramType = "query", name = "orderTransportData", value = "订单信息", dataType = "OrderTransportData")
    public ModelAndView insertOrderTransportDateController(@Valid OrderTransportData orderTransportData, BindingResult result) {
        ModelAndView modelAndView = new ModelAndView();
        return modelAndView;
    }

    /**
     * 根据订单id删除订单信息
     *
     * @param orderId
     * @return Msg
     */
    @ResponseBody
    @RequestMapping("/deleteOrderTransportDate")
    @ApiOperation(value = "根据订单id删除订单信息", httpMethod = "POST", response = Msg.class)
    @ApiImplicitParam(paramType = "query", name = "orderId", value = "订单id", dataType = "String")
    public ModelAndView deleteOrderTransportDateController(@Param("orderId") String orderId) {
        ModelAndView modelAndView = new ModelAndView();
        return modelAndView;
    }

    /**
     * 根据订单id更改订单信息
     *
     * @param orderTransportData
     * @param orderId
     * @return Msg
     */
    @ResponseBody
    @RequestMapping("/updateOrderTransportDate")
    @ApiOperation(value = "根据订单id更改订单信息", httpMethod = "POST", response = Msg.class)
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "orderTransportData", value = "订单信息", dataType = "OrderTransportData"),
            @ApiImplicitParam(paramType = "query", name = "orderId", value = "订单id", dataType = "String")
    })
    public ModelAndView updateOrderTransportDateController(@Valid OrderTransportData orderTransportData, @Param("orderId") String orderId) {
        ModelAndView modelAndView = new ModelAndView();
        return modelAndView;

    }

    /**
     * 根据用户id查询订单信息
     * @param userId
     * @return Msg
     */
    @ResponseBody
    @RequestMapping("/selectOrderTransportDate")
    @ApiOperation(value = "根据用户id查询订单信息", httpMethod = "POST", response = Msg.class)
    @ApiImplicitParam(paramType = "query", name = "userId", value = "用户id", dataType = "String")
    public ModelAndView selectOrderTransportDateController(@Param("userId") String userId, @RequestParam(value = "startPage", defaultValue = "1") Integer startPage) {
        ModelAndView modelAndView = new ModelAndView();
        return modelAndView;
    }
}
